'\" e
'\"! eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 01 evalmesh.
.ds Xs 32277 7 evalmesh.gl
.TH GLEVALMESH 3G
.SH NAME
.B "glEvalMesh1, glEvalMesh2
\- compute a one- or two-dimensional grid of points or lines

.SH C SPECIFICATION
void \f3glEvalMesh1\fP(
GLenum \fImode\fP,
.nf
.ta \w'\f3void \fPglEvalMesh1( 'u
	GLint \fIi1\fP,
	GLint \fIi2\fP )
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\f2mode\fP\ \ 'u 
\f2mode\fP
In \%\f3glEvalMesh1\fP, specifies whether to compute a one-dimensional mesh of points or lines.
Symbolic constants
\%\f3GL_POINT\fP and
\%\f3GL_LINE\fP are accepted.
.TP
\f2i1\fP, \f2i2\fP
Specify the first and last integer values for grid domain variable $i$.
.SH C SPECIFICATION
void \f3glEvalMesh2\fP(
GLenum \fImode\fP,
.nf
.ta \w'\f3void \fPglEvalMesh2( 'u
	GLint \fIi1\fP,
	GLint \fIi2\fP,
	GLint \fIj1\fP,
	GLint \fIj2\fP )
.fi

.SH PARAMETERS
.TP
\f2mode\fP
In \%\f3glEvalMesh2\fP, specifies whether to compute a two-dimensional mesh of points, lines,
or polygons.
Symbolic constants
\%\f3GL_POINT\fP,
\%\f3GL_LINE\fP, and
\%\f3GL_FILL\fP are accepted.
.TP
\f2i1\fP, \f2i2\fP
Specify the first and last integer values for grid domain variable $i$.
.TP
\f2j1\fP, \f2j2\fP
Specify the first and last integer values for grid domain variable $j$.
.SH DESCRIPTION
\%\f3glMapGrid\fP and \%\f3glEvalMesh\fP are used in tandem to efficiently
generate and evaluate a series of evenly-spaced map domain values.
\%\f3glEvalMesh\fP steps through the integer domain of a one- or two-dimensional grid,
whose range is the domain of the evaluation maps specified by
\%\f3glMap1\fP and \%\f3glMap2\fP.
\f2mode\fP determines whether the resulting vertices are connected as
points,
lines,
or filled polygons.
.P
In the one-dimensional case,
\%\f3glEvalMesh1\fP,
the mesh is generated as if the following code fragment were executed:
.nf
.IP
\f7
glBegin( \f2type\f7 );
for ( i = \f2i1\fP; i <= \f2i2\fP; i += 1 )
   glEvalCoord1( i$^cdot^DELTA u ~+~ u sub 1$ );
glEnd();
\fP
.RE
.fi
where
.sp
.in
$ DELTA u ~=~ (u sub 2 ~-~ u sub 1 ) ^/^ n$
.sp
.in 0
.P
and $n$, $u sub 1$, and $u sub 2$ are the arguments to the most recent
\%\f3glMapGrid1\fP command.
\f2type\fP is \%\f3GL_POINTS\fP if \f2mode\fP is \%\f3GL_POINT\fP,
or \%\f3GL_LINES\fP if \f2mode\fP is \%\f3GL_LINE\fP.
.P
The one absolute numeric requirement is that if $i ~=~ n$, then the
value computed from $ i^cdot^DELTA u ~+~ u sub 1$ is exactly $u sub 2$.
.P
In the two-dimensional case, \%\f3glEvalMesh2\fP, let 
.nf
.IP
$ DELTA u ~=~ mark ( u sub 2 ~-~ u sub 1 ) ^/^ n$
.sp
$ DELTA v ~=~ lineup ( v sub 2 ~-~ v sub 1 ) ^/^ m$,
.fi
.RE
.P
where $n$, $u sub 1$, $u sub 2$, $m$, $v sub 1$, and $v sub 2$ are the
arguments to the most recent \%\f3glMapGrid2\fP command.  Then, if
\f2mode\fP is \%\f3GL_FILL\fP, the \%\f3glEvalMesh2\fP command is equivalent
to:
.nf
.IP
\f7
for ( j = \f2j1\fP; j < \f2j2\fP; j += 1 ) {
   glBegin( GL_QUAD_STRIP );
   for ( i = \f2i1\fP; i <= \f2i2\fP; i += 1 ) {
      glEvalCoord2( i$^cdot^DELTA u ~+~ u sub 1$, j$^cdot^DELTA v ~+~ v sub 1$ );
      glEvalCoord2( i$^cdot^DELTA u ~+~ u sub 1$, (j+1)$^cdot^DELTA v ~+~ v sub 1$ );
   }
   glEnd();
}
\fP
.RE
.fi
.P
If \f2mode\fP is \%\f3GL_LINE\fP, then a call to \%\f3glEvalMesh2\fP is equivalent to:
.nf
.IP
\f7
for ( j = \f2j1\fP; j <= \f2j2\fP; j += 1 ) {
   glBegin( GL_LINE_STRIP );
   for ( i = \f2i1\fP; i <= \f2i2\fP; i += 1 )
      glEvalCoord2( i$^cdot^DELTA u ~+~ u sub 1$, j$^cdot^DELTA v ~+~ v sub 1$ );
   glEnd();
}
.sp
for ( i = \f2i1\fP;  i <= \f2i2\fP; i += 1 ) {
   glBegin( GL_LINE_STRIP );
   for ( j = \f2j1\fP; j <= \f2j1\fP; j += 1 )
      glEvalCoord2( i$^cdot^DELTA u ~+~ u sub 1$, j$^cdot^DELTA v ~+~ v sub 1 $ );
   glEnd();
}
\fP
.RE
.fi
.P
And finally, if \f2mode\fP is \%\f3GL_POINT\fP, then a call to
\%\f3glEvalMesh2\fP is equivalent to:
.nf
.IP
\f7
glBegin( GL_POINTS );
for ( j = \f2j1\fP; j <= \f2j2\fP; j += 1 )
   for ( i = \f2i1\fP; i <= \f2i2\fP; i += 1 )
      glEvalCoord2( i$^cdot^DELTA u ~+~ u sub 1$, j$^cdot^DELTA v ~+~ v sub 1$ );
glEnd();
\fP
.RE
.fi
.P
In all three cases, the only absolute numeric requirements are that if $i~=~n$,
then the value computed from $i^cdot^DELTA u ~+~ u sub 1$ is exactly $u
sub 2$, and if $j~=~m$, then the value computed from
$j ^cdot^ DELTA v ~+~ v sub 1$ is exactly $v sub 2$.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2mode\fP is not an accepted value.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glEvalMesh\fP
is executed between the execution of \%\f3glBegin\fP
and the corresponding execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS
\%\f3glGet\fP with argument \%\f3GL_MAP1_GRID_DOMAIN\fP
.br
\%\f3glGet\fP with argument \%\f3GL_MAP2_GRID_DOMAIN\fP
.br
\%\f3glGet\fP with argument \%\f3GL_MAP1_GRID_SEGMENTS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_MAP2_GRID_SEGMENTS\fP
.SH SEE ALSO
\%\f3glBegin(3G)\fP,
\%\f3glEvalCoord(3G)\fP,
\%\f3glEvalPoint(3G)\fP,
\%\f3glMap1(3G)\fP,
\%\f3glMap2(3G)\fP,
\%\f3glMapGrid(3G)\fP
